package com.tao.topic;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.utils.RabbitMQUtils;

import java.io.IOException;

/**
 * @ClassName Provider
 * @Author HETAO
 * @Date 2020/5/4 23:10
 */
public class Provider {
    public static void main(String[] args) throws IOException {
        Connection connection = RabbitMQUtils.getConnection();
        Channel channel = connection.createChannel();
        channel.exchangeDeclare("topics", "topic", false);
        String key = "user.add.xxx";
        channel.basicPublish("topics", key, null, ("topic模式发送routing key [ " + key + "] ").getBytes());

        RabbitMQUtils.closeConnectionAndChanel(channel, connection);
    }
}
